import { HashRouter as Rotuer, Switch, Route, Redirect } from 'react-router-dom'
import App from '../App'
import Home from '../views/Home'
import Fast from '../views/Fast'
import User from '../views/User'
import Login from '@/views/Login'
import Reg from '@/views/Reg'
import SelectQuestion from '../views/SelectQuestion/idnex'
import Practice from '../views/Practice'


const BaseRouter = () => {
    return (
        <Rotuer>
            <Switch>
                {/* <Route path="/login" component={Login}></Route>
                <Route path="/reg" component={Reg}></Route> */}
                <Route path="/" component={() => {
                    return <App>
                        <Switch>
                            <Route exact path="/home" component={Home}></Route>
                            <Route exact path="/fast" component={Fast}></Route>
                            <Route exact path="/user" component={User}></Route>
                            {/* sq === SelectQuestion */}
                            <Route exact path="/sq/:code" component={SelectQuestion}></Route>
                            {/* 做题页面 */}
                            <Route exact path="/pr" component={Practice}></Route>
                            <Route path="/login" component={Login}></Route>
                            <Route path="/reg" component={Reg}></Route>
                            <Redirect to="/home"></Redirect>
                        </Switch>
                    </App>
                }}></Route>
            </Switch>
        </Rotuer>
    )
}

export default BaseRouter